%%%-------------------------------------------------------------------
%%% @author kk
%%% @copyright (C) 2024, <COMPANY>
%%% @doc
%%% 查找元素在元组或列表中的位置
%%% @end
%%% Created : 19. 7月 2024 12:00
%%%-------------------------------------------------------------------
-module(d6).
-author("kk").

%% API
-export([getIndex/2, getIndex/1]).

getIndex([]) -> 0.
getIndex(List, Num) -> getIndex(List, Num, 0).
getIndex([H | List], Num, Index) ->
  if
    H =:= Num -> Index + 1;
    true -> getIndex(List, Num, Index + 1)
  end.
